package ShareYourWay.project;

// Generated 04-dic-2013 10:29:32 by Hibernate Tools 3.4.0.CR1

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;

import static javax.persistence.GenerationType.IDENTITY;

import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * User generated by hbm2java
 */
@Entity
@Table(name = "user", catalog = "shareyourway")
public class User implements java.io.Serializable {

	private Integer id;
	private University university;
	private String name;
	private String surname;
	private String password;
	private String nick;
	private boolean car;
	private String phone;
	private String mail;
	private String city;
	private Boolean banned;
	private String sex;
	private Integer score;
	private Set<Usermeetup> usermeetups = new HashSet<Usermeetup>(0);
	private Set<Meetup> meetups = new HashSet<Meetup>(0);

	public User() {
	}
	

	public User(String name, String surname, String password, String nick,
			boolean car, String phone, String mail, String city, String sex) {
		super();
		this.name = name;
		this.surname = surname;
		this.password = password;
		this.nick = nick;
		this.car = car;
		this.phone = phone;
		this.mail = mail;
		this.city = city;
		this.sex = sex;
	}









	public User(String name, String surname, String password, String nick,
			boolean car, String mail) {
		this.name = name;
		this.surname = surname;
		this.password = password;
		this.nick = nick;
		this.car = car;
		this.mail = mail;
	}

	public User(University university, String name, String surname,
			String password, String nick, boolean car, String phone,
			String mail, String city, Boolean banned, String sex,
			Integer score, Set<Usermeetup> usermeetups, Set<Meetup> meetups) {
		this.university = university;
		this.name = name;
		this.surname = surname;
		this.password = password;
		this.nick = nick;
		this.car = car;
		this.phone = phone;
		this.mail = mail;
		this.city = city;
		this.banned = banned;
		this.sex = sex;
		this.score = score;
		this.usermeetups = usermeetups;
		this.meetups = meetups;
	}

	public User(User user) {
		this.name = user.name;
		this.surname = user.surname;
		this.nick = user.nick;
		this.mail = user.mail;
		this.password = user.password;
		this.car = false;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "id_school")
	public University getUniversity() {
		return this.university;
	}

	public void setUniversity(University university) {
		this.university = university;
	}

	@Column(name = "name", nullable = false, length = 20)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "surname", nullable = false, length = 20)
	public String getSurname() {
		return this.surname;
	}

	public void setSurname(String surname) {
		this.surname = surname;
	}

	@Column(name = "password", nullable = false, length = 50)
	public String getPassword() {
		return this.password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	@Column(name = "nick", nullable = false, length = 15)
	public String getNick() {
		return this.nick;
	}

	public void setNick(String nick) {
		this.nick = nick;
	}

	@Column(name = "car", nullable = false)
	public boolean isCar() {
		return this.car;
	}

	public void setCar(boolean car) {
		this.car = car;
	}

	@Column(name = "phone", length = 15)
	public String getPhone() {
		return this.phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	@Column(name = "mail", nullable = false, length = 50)
	public String getMail() {
		return this.mail;
	}

	public void setMail(String mail) {
		this.mail = mail;
	}

	@Column(name = "city", length = 30)
	public String getCity() {
		return this.city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	@Column(name = "banned")
	public Boolean getBanned() {
		return this.banned;
	}

	public void setBanned(Boolean banned) {
		this.banned = banned;
	}

	@Column(name = "sex", length = 10)
	public String getSex() {
		return this.sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	@Column(name = "score")
	public Integer getScore() {
		return this.score;
	}

	public void setScore(Integer score) {
		this.score = score;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "user")
	public Set<Usermeetup> getUsermeetups() {
		return this.usermeetups;
	}

	public void setUsermeetups(Set<Usermeetup> usermeetups) {
		this.usermeetups = usermeetups;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "user")
	public Set<Meetup> getMeetups() {
		return this.meetups;
	}

	public void setMeetups(Set<Meetup> meetups) {
		this.meetups = meetups;
	}

}
